package top.psjj.news.web;

import top.psjj.news.utils.UploadUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Auther:小陈的Java
 */
@WebServlet("/imageUpload")
public class UploadServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf-8");
        String url = UploadUtils.uploadFile(req,"/temp","userImage");
        resp.getWriter().println(url);
    }
}
